package singsong;

import java.io.File;

import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.Mixer;

public class Track {
	private String name;
	
	private boolean audible = true;
	
	private String instrument;
	
	private TrackData data;
	
	private Clip clip;
	
	public Track(String name, TrackData data) {
		this.name = name;
		this.data = data;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isAudible() {
		return audible;
	}

	public void setAudible(boolean audible) {
		this.audible = audible;
	}

	public String getInstrument() {
		return instrument;
	}

	public void setInstrument(String instrument) {
		this.instrument = instrument;
	}

	public TrackData getData() {
		return data;
	}

	public void recordClip() {
		// Demo.
		Mixer mixer = AudioSystem.getMixer(AudioSystem.getMixerInfo()[0]);
		System.out.println(new File("").getAbsolutePath());
		Instrument instrument = new Instrument("instruments/guitar/guitar.instrument");
		RecordedAudioClip recording = instrument.record(data);
		clip = recording.convertToClip(mixer);
	}
	
	public Clip getClip() {
		return clip;
	}
}
